using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using FiltronASP.Modules.Abstracts;
using FiltronASP.Models.DAO.Interfaces;
using FiltronASP.Models;
using FiltronASP.Models.DAO.Filtron;
using FiltronASP.Models.DAO.Extensions;
using FiltronASP.Models.DAO.Interfaces.Filtron;

namespace FiltronASP.Modules
{
    public class mainSearchFiltron : AbstractModule
    {

        /// <summary>
        /// Klasa odpowiedzialna za generowanie contentu przez modul.
        /// </summary>
        /// <param name="page">biezaca strona</param>
        /// <returns>content</returns>
        public override string GenerateContent(FiltronASP.Models.Page page)
        {
            string htmlToReturn = "";
            htmlToReturn += "<div class=\"rightMenuBoxInner\">";
            htmlToReturn += "<div class=\"catalogueDropdownContainer\">";
            htmlToReturn += "    <select onchange=\"doBrandWork('id_master', 'id_BrandDetail')\" id=\"id_master\" name=\"passenger_car\" id=\"cat_firstSelect\" >";

            IFiltronVehicleDAO VehicleDAO = new FiltronVehicleDAO();
            IQueryable<FiltronVehicle> filtronVehicles = VehicleDAO.FindAll();
            foreach (FiltronVehicle vehicle in filtronVehicles)
            {
                htmlToReturn += "<option value=\""+vehicle.vehicle_id+"\">"+vehicle.vehicle_name+"</option>";
            }

            htmlToReturn += "    </select>";
            htmlToReturn += "</div>";
            htmlToReturn += "<div class=\"catalogueDropdownContainer\">";
            htmlToReturn += "    <label for=\"carBrand\">Brand</label>";
            htmlToReturn += "    <select onchange=\"doWork('id_BrandDetail', 'id_carTypeDetail')\" name=\"\" id=\"id_BrandDetail\">";
            htmlToReturn += "        <option value=\"\">---</option>";
            htmlToReturn += "    </select>";
            htmlToReturn += "</div>";
            htmlToReturn += "<div class=\"catalogueDropdownContainer\">";
            htmlToReturn += "    <label for=\"carType\">Type</label>";
            htmlToReturn += "    <select name=\"\" id=\"id_carTypeDetail\">";
            htmlToReturn += "        <option value=\"\">--</option>";
            htmlToReturn += "    </select>";
            htmlToReturn += "</div>";
            htmlToReturn += "<p>Enter a Filtron, competitor, or manufacturer part number below to find the right Filtron filter for you.</p>";
            htmlToReturn += "<input type=\"text\" onkeyup=\"clearSpaces(this);\" class=\"searchInput\" id=\"query\" name=\"searchString\" />";
            htmlToReturn += "<a href=\"\" class=\"searchSubmit\"><span class=\"hidden\">Search</span></a>";
            htmlToReturn += "</div>";

            return htmlToReturn;
        }
    }
}
